package com.autumn.annotations.ioclife.beanpostprocesser;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.stereotype.Component;

/**
 * ClassName: MyBeanPostProcesser
 *
 * @Description:
 * @Author: wangqiuyang
 * @Date: 2022/1/25 3:00 下午
 * History:
 * <author>          <time>          <version>          <desc>
 * wangqiuyang    2022/1/25 3:00 下午   @Version 1.0        描述
 */
@Component // 将后置处理器加入到spring容器中
public class MyBeanPostProcesser implements BeanPostProcessor {

    @Override
    public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
        System.out.println("postProcessBeforeInitialization ... beanName : " + beanName + " => " + bean);
        return bean;
    }

    @Override
    public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
        System.out.println("postProcessAfterInitialization ... beanName : " + beanName + " => " + bean);
        return bean;
    }
}
